package com.softa.service.system.impl;

import com.github.pagehelper.ISelect;
import com.github.pagehelper.PageInfo;
import com.softa.annotation.ServiceLog;
import com.softa.bean.DataGridModel;
import com.softa.cache.util.RedisUitl;
import com.softa.dao.dto.SysMessageDTO;
import com.softa.dao.mapper.base.SysBaseMapper;
import com.softa.dao.mapper.relation.system.SysBaseRelationMapper;
import com.softa.dao.mapper.relation.system.SysMessageRelationMapper;
import com.softa.dao.model.SysBase;
import com.softa.service.system.SysBaseService;
import com.softa.service.system.SysMessageService;
import com.softa.vo.DataGridRequest;
import com.softa.vo.QueryRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

@Service
public class SysBaseServiceImpl implements SysBaseService {

    @Autowired
    private SysBaseMapper sysBaseMapper;
    @Autowired
    private SysBaseRelationMapper sysBaseRelationMapper;
    @Autowired
    private RedisUitl redisUitl;

    /**
     * 创建用户
     * @param sysBase
     */
    @ServiceLog(value="保存系统名称")
    public String createSysBase(SysBase sysBase) {
        redisUitl.put("sysname", sysBase.getSysname());
        String str="录入成功";
        SysBase sb = sysBaseRelationMapper.selectAll();
        if (null != sb) {
            sb.setSysname(sysBase.getSysname());
            sysBaseMapper.updateByPrimaryKey(sb);
        } else {
            sysBaseMapper.insertSelective(sysBase);
        }
        return str;
    }
}
